package com.seh.usercenter.utils;

import com.seh.usercenter.domain.Result;

public class ResultUtil {
    public static<T> Result success(String code, String msg, T data) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static<T> Result success(T data) {
        Result result = success("100", "成功", data);
        return result;
    }

    public static <T> Result userInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result userInfo(T data){
        Result result = userInfo("200","用户信息", data);
        return result;
    }
    public static <T> Result phoneInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result phoneInfo(T data){
        Result result = phoneInfo("303","手机信息", data);
        return result;
    }

    public static<T> Result error(String code, String msg, T data) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result error(T data){
        Result result = error("04040","错误信息", data);
        return result;
    }
}










